{"ast":null,"code":"import _slicedToArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { unstable_useControlled as useControlled, unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils';\n\n/**\n * The basic building block for creating custom switches.\n *\n * Demos:\n *\n * - [Switches](https://mui.com/components/switches/)\n */\nexport default function useSwitch(props) {\n  var checkedProp = props.checked,\n    defaultChecked = props.defaultChecked,\n    disabled = props.disabled,\n    onBlur = props.onBlur,\n    onChange = props.onChange,\n    onFocus = props.onFocus,\n    onFocusVisible = props.onFocusVisible,\n    readOnly = props.readOnly,\n    required = props.required;\n  var _useControlled = useControlled({\n      controlled: checkedProp,\n      default: Boolean(defaultChecked),\n      name: 'Switch',\n      state: 'checked'\n    }),\n    _useControlled2 = _slicedToArray(_useControlled, 2),\n    checked = _useControlled2[0],\n    setCheckedState = _useControlled2[1];\n  var createHandleInputChange = function createHandleInputChange(otherProps) {\n    return function (event) {\n      var _otherProps$onChange;\n\n      // Workaround for https://github.com/facebook/react/issues/9023\n      if (event.nativeEvent.defaultPrevented) {\n        return;\n      }\n      setCheckedState(event.target.checked);\n      onChange == null ? void 0 : onChange(event);\n      (_otherProps$onChange = otherProps.onChange) == null ? void 0 : _otherProps$onChange.call(otherProps, event);\n    };\n  };\n  var _useIsFocusVisible = useIsFocusVisible(),\n    isFocusVisibleRef = _useIsFocusVisible.isFocusVisibleRef,\n    handleBlurVisible = _useIsFocusVisible.onBlur,\n    handleFocusVisible = _useIsFocusVisible.onFocus,\n    focusVisibleRef = _useIsFocusVisible.ref;\n  var _React$useState = React.useState(false),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    focusVisible = _React$useState2[0],\n    setFocusVisible = _React$useState2[1];\n  if (disabled && focusVisible) {\n    setFocusVisible(false);\n  }\n  React.useEffect(function () {\n    isFocusVisibleRef.current = focusVisible;\n  }, [focusVisible, isFocusVisibleRef]);\n  var inputRef = React.useRef(null);\n  var createHandleFocus = function createHandleFocus(otherProps) {\n    return function (event) {\n      var _otherProps$onFocus;\n\n      // Fix for https://github.com/facebook/react/issues/7769\n      if (!inputRef.current) {\n        inputRef.current = event.currentTarget;\n      }\n      handleFocusVisible(event);\n      if (isFocusVisibleRef.current === true) {\n        setFocusVisible(true);\n        onFocusVisible == null ? void 0 : onFocusVisible(event);\n      }\n      onFocus == null ? void 0 : onFocus(event);\n      (_otherProps$onFocus = otherProps.onFocus) == null ? void 0 : _otherProps$onFocus.call(otherProps, event);\n    };\n  };\n  var createHandleBlur = function createHandleBlur(otherProps) {\n    return function (event) {\n      var _otherProps$onBlur;\n      handleBlurVisible(event);\n      if (isFocusVisibleRef.current === false) {\n        setFocusVisible(false);\n      }\n      onBlur == null ? void 0 : onBlur(event);\n      (_otherProps$onBlur = otherProps.onBlur) == null ? void 0 : _otherProps$onBlur.call(otherProps, event);\n    };\n  };\n  var handleRefChange = useForkRef(focusVisibleRef, inputRef);\n  var getInputProps = function getInputProps() {\n    var otherProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n    return _extends({\n      checked: checkedProp,\n      defaultChecked: defaultChecked,\n      disabled: disabled,\n      readOnly: readOnly,\n      ref: handleRefChange,\n      required: required,\n      type: 'checkbox'\n    }, otherProps, {\n      onChange: createHandleInputChange(otherProps),\n      onFocus: createHandleFocus(otherProps),\n      onBlur: createHandleBlur(otherProps)\n    });\n  };\n  return {\n    checked: checked,\n    disabled: Boolean(disabled),\n    focusVisible: focusVisible,\n    getInputProps: getInputProps,\n    readOnly: Boolean(readOnly)\n  };\n}","map":{"version":3,"names":["_extends","React","unstable_useControlled","useControlled","unstable_useForkRef","useForkRef","unstable_useIsFocusVisible","useIsFocusVisible","useSwitch","props","checkedProp","checked","defaultChecked","disabled","onBlur","onChange","onFocus","onFocusVisible","readOnly","required","controlled","default","Boolean","name","state","setCheckedState","createHandleInputChange","otherProps","event","_otherProps$onChange","nativeEvent","defaultPrevented","target","call","isFocusVisibleRef","handleBlurVisible","handleFocusVisible","focusVisibleRef","ref","useState","focusVisible","setFocusVisible","useEffect","current","inputRef","useRef","createHandleFocus","_otherProps$onFocus","currentTarget","createHandleBlur","_otherProps$onBlur","handleRefChange","getInputProps","type"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@mui/base/SwitchUnstyled/useSwitch.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { unstable_useControlled as useControlled, unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils';\n\n/**\n * The basic building block for creating custom switches.\n *\n * Demos:\n *\n * - [Switches](https://mui.com/components/switches/)\n */\nexport default function useSwitch(props) {\n  const {\n    checked: checkedProp,\n    defaultChecked,\n    disabled,\n    onBlur,\n    onChange,\n    onFocus,\n    onFocusVisible,\n    readOnly,\n    required\n  } = props;\n  const [checked, setCheckedState] = useControlled({\n    controlled: checkedProp,\n    default: Boolean(defaultChecked),\n    name: 'Switch',\n    state: 'checked'\n  });\n\n  const createHandleInputChange = otherProps => event => {\n    var _otherProps$onChange;\n\n    // Workaround for https://github.com/facebook/react/issues/9023\n    if (event.nativeEvent.defaultPrevented) {\n      return;\n    }\n\n    setCheckedState(event.target.checked);\n    onChange == null ? void 0 : onChange(event);\n    (_otherProps$onChange = otherProps.onChange) == null ? void 0 : _otherProps$onChange.call(otherProps, event);\n  };\n\n  const {\n    isFocusVisibleRef,\n    onBlur: handleBlurVisible,\n    onFocus: handleFocusVisible,\n    ref: focusVisibleRef\n  } = useIsFocusVisible();\n  const [focusVisible, setFocusVisible] = React.useState(false);\n\n  if (disabled && focusVisible) {\n    setFocusVisible(false);\n  }\n\n  React.useEffect(() => {\n    isFocusVisibleRef.current = focusVisible;\n  }, [focusVisible, isFocusVisibleRef]);\n  const inputRef = React.useRef(null);\n\n  const createHandleFocus = otherProps => event => {\n    var _otherProps$onFocus;\n\n    // Fix for https://github.com/facebook/react/issues/7769\n    if (!inputRef.current) {\n      inputRef.current = event.currentTarget;\n    }\n\n    handleFocusVisible(event);\n\n    if (isFocusVisibleRef.current === true) {\n      setFocusVisible(true);\n      onFocusVisible == null ? void 0 : onFocusVisible(event);\n    }\n\n    onFocus == null ? void 0 : onFocus(event);\n    (_otherProps$onFocus = otherProps.onFocus) == null ? void 0 : _otherProps$onFocus.call(otherProps, event);\n  };\n\n  const createHandleBlur = otherProps => event => {\n    var _otherProps$onBlur;\n\n    handleBlurVisible(event);\n\n    if (isFocusVisibleRef.current === false) {\n      setFocusVisible(false);\n    }\n\n    onBlur == null ? void 0 : onBlur(event);\n    (_otherProps$onBlur = otherProps.onBlur) == null ? void 0 : _otherProps$onBlur.call(otherProps, event);\n  };\n\n  const handleRefChange = useForkRef(focusVisibleRef, inputRef);\n\n  const getInputProps = (otherProps = {}) => _extends({\n    checked: checkedProp,\n    defaultChecked,\n    disabled,\n    readOnly,\n    ref: handleRefChange,\n    required,\n    type: 'checkbox'\n  }, otherProps, {\n    onChange: createHandleInputChange(otherProps),\n    onFocus: createHandleFocus(otherProps),\n    onBlur: createHandleBlur(otherProps)\n  });\n\n  return {\n    checked,\n    disabled: Boolean(disabled),\n    focusVisible,\n    getInputProps,\n    readOnly: Boolean(readOnly)\n  };\n}"],"mappings":";AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,sBAAsB,IAAIC,aAAa,EAAEC,mBAAmB,IAAIC,UAAU,EAAEC,0BAA0B,IAAIC,iBAAiB,QAAQ,YAAY;;AAExJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,SAAS,CAACC,KAAK,EAAE;EACvC,IACWC,WAAW,GASlBD,KAAK,CATPE,OAAO;IACPC,cAAc,GAQZH,KAAK,CARPG,cAAc;IACdC,QAAQ,GAONJ,KAAK,CAPPI,QAAQ;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